/*
 * Decompiled with CFR 0.150.
 * 
 * Could not load the following classes:
 *  cn.hutool.core.util.ObjectUtil
 *  com.alibaba.fastjson.JSON
 *  de.felixroske.jfxsupport.FXMLController
 *  javafx.beans.value.ChangeListener
 *  javafx.beans.value.ObservableValue
 *  javafx.collections.FXCollections
 *  javafx.collections.ObservableList
 *  javafx.fxml.FXML
 *  javafx.fxml.Initializable
 *  javafx.scene.control.Alert
 *  javafx.scene.control.Alert$AlertType
 *  javafx.scene.control.TableColumn
 *  javafx.scene.control.TableView
 *  javafx.scene.control.cell.PropertyValueFactory
 *  javafx.scene.layout.AnchorPane
 *  javafx.util.Callback
 *  org.slf4j.Logger
 *  org.slf4j.LoggerFactory
 *  org.springframework.beans.factory.annotation.Autowired
 */
package com.gys.controller.salesReceipts;

import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.gys.common.business.SalesReceiptsUtil;
import com.gys.common.data.HttpJson;
import com.gys.common.util.CommonUtil;
import com.gys.controller.BaseController;
import com.gys.controller.dataManger.ControllerManger;
import com.gys.controller.salesReceipts.SalesReceiptsMainController;
import com.gys.data.salesReceipts.ActiveInfo;
import com.gys.data.salesReceipts.GetDisPriceOutData;
import com.gys.data.salesReceipts.GetNumAmtData;
import com.gys.data.salesReceipts.GetPromByProCodeOutData;
import com.gys.data.salesReceipts.GetSalesReceiptsTableOutData;
import com.gys.data.salesReceipts.SaleActSelectTableOneData;
import com.gys.data.salesReceipts.SaleActSelectTableTwoData;
import de.felixroske.jfxsupport.FXMLController;
import java.math.BigDecimal;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.ResourceBundle;
import java.util.Set;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.AnchorPane;
import javafx.util.Callback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

@FXMLController
public class SaleActSelectController
extends BaseController
implements Initializable {
    private static final Logger log = LoggerFactory.getLogger(SaleActSelectController.class);
    @FXML
    private AnchorPane pane;
    @FXML
    private TableView<SaleActSelectTableOneData> tableView;
    @FXML
    private TableColumn<SaleActSelectTableOneData, String> promotionNameF;
    @FXML
    private TableColumn<SaleActSelectTableOneData, String> endTimeF;
    @FXML
    private TableColumn<SaleActSelectTableOneData, String> voucherIdF;
    @FXML
    private TableColumn<SaleActSelectTableOneData, String> startTimeF;
    @FXML
    private TableColumn<SaleActSelectTableOneData, String> promotionContentF;
    @FXML
    private TableColumn<SaleActSelectTableOneData, String> endDataF;
    @FXML
    private TableColumn<SaleActSelectTableOneData, String> indexF;
    @FXML
    private TableColumn<SaleActSelectTableOneData, String> startDataF;
    @FXML
    private TableColumn<SaleActSelectTableOneData, String> dataF;
    @FXML
    private TableColumn<SaleActSelectTableOneData, String> weekF;
    @FXML
    private TableView<SaleActSelectTableTwoData> tableViewTwo;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> unionMoney;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> voucherIdS;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> normalPriceS;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> proCodeS;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> indexS;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> unionDis;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> typeS;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> proNameS;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> priceOne;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> resultDisOne;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> disOne;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> resultSubOne;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> disTwo;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> resultDisTwo;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> priceTwo;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> resultSubTwo;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> resultDisThree;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> disThree;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> priceThree;
    @FXML
    private TableColumn<SaleActSelectTableTwoData, String> resultSubThree;
    @Autowired
    private SalesReceiptsMainController salesReceiptsMainController;
    private ObservableList<SaleActSelectTableOneData> sortObservableTableList = FXCollections.observableArrayList(new ArrayList());
    private ObservableList<SaleActSelectTableTwoData> sortObservableTableTwoList = FXCollections.observableArrayList(new ArrayList());
    public List<GetPromByProCodeOutData> promByProCodeOutDataArrayList = new ArrayList<GetPromByProCodeOutData>();

    public void initialize(URL location, ResourceBundle resources) {
        ControllerManger.controllerMap.put(this.getClass().getSimpleName(), this);
        this.bangding();
        this.init();
    }

    @Override
    public void init() {
        if (ObjectUtil.isEmpty(this.pane)) {
            return;
        }
        this.sortObservableTableTwoList.clear();
        this.tableViewTwo.refresh();
        this.initTable();
        this.tableClick();
    }

    private void tableClick() {
        this.tableView.getSelectionModel().selectedItemProperty().addListener((ChangeListener)new ChangeListener<SaleActSelectTableOneData>(){

            public void changed(ObservableValue<? extends SaleActSelectTableOneData> observableValue, SaleActSelectTableOneData oldItem, SaleActSelectTableOneData newItem) {
                if (ObjectUtil.isEmpty(newItem)) {
                    return;
                }
                SaleActSelectController.this.sortObservableTableTwoList.clear();
                if (ObjectUtil.isNotEmpty(newItem.getSaleActSelectTableTwoDataList())) {
                    SaleActSelectController.this.sortObservableTableTwoList = FXCollections.observableArrayList(newItem.getSaleActSelectTableTwoDataList());
                    SaleActSelectController.this.tableViewTwo.setItems(SaleActSelectController.this.sortObservableTableTwoList);
                }
                SaleActSelectController.this.tableViewTwo.refresh();
            }
        });
    }

    private void initTable() {
        this.sortObservableTableList.clear();
        for (int i = 0; i < this.promByProCodeOutDataArrayList.size(); ++i) {
            GetPromByProCodeOutData item = this.promByProCodeOutDataArrayList.get(i);
            SaleActSelectTableOneData saleActSelectTableOneData = new SaleActSelectTableOneData();
            saleActSelectTableOneData.setIndexF(String.valueOf(i + 1));
            saleActSelectTableOneData.setVoucherIdF(item.getGsphVoucherId());
            saleActSelectTableOneData.setPromotionNameF(item.getPromotionName());
            saleActSelectTableOneData.setPromotionContentF(item.getPromotionContent());
            saleActSelectTableOneData.setStartDataF(item.getGsphBeginDate());
            saleActSelectTableOneData.setEndDataF(item.getGsphEndDate());
            saleActSelectTableOneData.setStartTimeF(item.getGsphBeginTime());
            saleActSelectTableOneData.setEndTimeF(item.getGsphEndTime());
            saleActSelectTableOneData.setDataF(item.getGsphDateFrequency());
            saleActSelectTableOneData.setWeekF(item.getGsphWeekFrequency());
            ArrayList<SaleActSelectTableTwoData> saleActSelectTableTwoDataList = new ArrayList<SaleActSelectTableTwoData>();
            for (int j = 0; j < item.getActiveInfo().size(); ++j) {
                ActiveInfo activeInfo = item.getActiveInfo().get(j);
                SaleActSelectTableTwoData saleActSelectTableTwoData = this.covert(activeInfo, j);
                saleActSelectTableTwoDataList.add(saleActSelectTableTwoData);
            }
            saleActSelectTableOneData.setSaleActSelectTableTwoDataList(saleActSelectTableTwoDataList);
            this.sortObservableTableList.add(saleActSelectTableOneData);
        }
        this.tableView.setItems(this.sortObservableTableList);
        this.tableView.refresh();
    }

    private SaleActSelectTableTwoData covert(ActiveInfo activeInfo, int j) {
        SaleActSelectTableTwoData saleActSelectTableTwoData = new SaleActSelectTableTwoData();
        saleActSelectTableTwoData.setIndexS(String.valueOf(j + 1));
        saleActSelectTableTwoData.setVoucherIdS(activeInfo.getGsphVoucherId());
        saleActSelectTableTwoData.setSerial(activeInfo.getSerial());
        saleActSelectTableTwoData.setTypeS(activeInfo.getGsphType());
        saleActSelectTableTwoData.setTypeIdS(activeInfo.getGsphTypeId());
        saleActSelectTableTwoData.setProCodeS(activeInfo.getProCode());
        saleActSelectTableTwoData.setProNameS(activeInfo.getProName());
        saleActSelectTableTwoData.setNormalPriceS(activeInfo.getNormalPrice());
        saleActSelectTableTwoData.setPriceOne(activeInfo.getPriceOne());
        saleActSelectTableTwoData.setDisOne(activeInfo.getDisOne());
        saleActSelectTableTwoData.setResultSubOne(activeInfo.getResultSubOne());
        saleActSelectTableTwoData.setResultDisOne(activeInfo.getResultDisOne());
        saleActSelectTableTwoData.setPriceTwo(activeInfo.getPriceTwo());
        saleActSelectTableTwoData.setDisTwo(activeInfo.getDisTwo());
        saleActSelectTableTwoData.setResultSubTwo(activeInfo.getResultSubTwo());
        saleActSelectTableTwoData.setResultDisTwo(activeInfo.getResultDisTwo());
        saleActSelectTableTwoData.setPriceThree(activeInfo.getPriceThree());
        saleActSelectTableTwoData.setDisThree(activeInfo.getDisThree());
        saleActSelectTableTwoData.setResultSubThree(activeInfo.getResultSubThree());
        saleActSelectTableTwoData.setResultDisThree(activeInfo.getResultDisThree());
        saleActSelectTableTwoData.setUnionMoney(activeInfo.getUnionMoney());
        saleActSelectTableTwoData.setUnionDis(activeInfo.getUnionDis());
        saleActSelectTableTwoData.setDisPrice(activeInfo.getDisPrice());
        saleActSelectTableTwoData.setDis(activeInfo.getDis());
        saleActSelectTableTwoData.setMemberFlag(activeInfo.getMemberFlag());
        saleActSelectTableTwoData.setActiveInfo(activeInfo);
        return saleActSelectTableTwoData;
    }

    private void bangding() {
        this.indexF.setCellValueFactory((Callback)new PropertyValueFactory(this.indexF.getId()));
        this.voucherIdF.setCellValueFactory((Callback)new PropertyValueFactory(this.voucherIdF.getId()));
        this.promotionNameF.setCellValueFactory((Callback)new PropertyValueFactory(this.promotionNameF.getId()));
        this.promotionContentF.setCellValueFactory((Callback)new PropertyValueFactory(this.promotionContentF.getId()));
        this.startDataF.setCellValueFactory((Callback)new PropertyValueFactory(this.startDataF.getId()));
        this.endDataF.setCellValueFactory((Callback)new PropertyValueFactory(this.endDataF.getId()));
        this.startTimeF.setCellValueFactory((Callback)new PropertyValueFactory(this.startTimeF.getId()));
        this.endTimeF.setCellValueFactory((Callback)new PropertyValueFactory(this.endTimeF.getId()));
        this.dataF.setCellValueFactory((Callback)new PropertyValueFactory(this.dataF.getId()));
        this.weekF.setCellValueFactory((Callback)new PropertyValueFactory(this.weekF.getId()));
        this.indexS.setCellValueFactory((Callback)new PropertyValueFactory(this.indexS.getId()));
        this.voucherIdS.setCellValueFactory((Callback)new PropertyValueFactory(this.voucherIdS.getId()));
        this.typeS.setCellValueFactory((Callback)new PropertyValueFactory(this.typeS.getId()));
        this.proCodeS.setCellValueFactory((Callback)new PropertyValueFactory(this.proCodeS.getId()));
        this.proNameS.setCellValueFactory((Callback)new PropertyValueFactory(this.proNameS.getId()));
        this.normalPriceS.setCellValueFactory((Callback)new PropertyValueFactory(this.normalPriceS.getId()));
        this.priceOne.setCellValueFactory((Callback)new PropertyValueFactory(this.priceOne.getId()));
        this.disOne.setCellValueFactory((Callback)new PropertyValueFactory(this.disOne.getId()));
        this.resultSubOne.setCellValueFactory((Callback)new PropertyValueFactory(this.resultSubOne.getId()));
        this.resultDisOne.setCellValueFactory((Callback)new PropertyValueFactory(this.resultDisOne.getId()));
        this.priceTwo.setCellValueFactory((Callback)new PropertyValueFactory(this.priceTwo.getId()));
        this.disTwo.setCellValueFactory((Callback)new PropertyValueFactory(this.disTwo.getId()));
        this.resultSubTwo.setCellValueFactory((Callback)new PropertyValueFactory(this.resultSubTwo.getId()));
        this.resultDisTwo.setCellValueFactory((Callback)new PropertyValueFactory(this.resultDisTwo.getId()));
        this.priceThree.setCellValueFactory((Callback)new PropertyValueFactory(this.priceThree.getId()));
        this.disThree.setCellValueFactory((Callback)new PropertyValueFactory(this.disThree.getId()));
        this.resultSubThree.setCellValueFactory((Callback)new PropertyValueFactory(this.resultSubThree.getId()));
        this.resultDisThree.setCellValueFactory((Callback)new PropertyValueFactory(this.resultDisThree.getId()));
        this.unionMoney.setCellValueFactory((Callback)new PropertyValueFactory(this.unionMoney.getId()));
        this.unionDis.setCellValueFactory((Callback)new PropertyValueFactory(this.unionDis.getId()));
    }

    @FXML
    private void sureAction() {
        SaleActSelectTableTwoData selectedItem = (SaleActSelectTableTwoData)this.tableViewTwo.getSelectionModel().getSelectedItem();
        if (ObjectUtil.isEmpty(selectedItem)) {
            Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", "\u8bf7\u9009\u62e9\u4fc3\u9500\u6d3b\u52a8\u8be6\u60c5");
            alert.showAndWait();
            return;
        }
        this.countPrice(selectedItem);
        this.salesReceiptsMainController.countMoney();
        this.cancelAction();
    }

    public void countPrice(SaleActSelectTableTwoData selectedItem) {
        if ("PROM_SINGLE".equals(selectedItem.getTypeIdS())) {
            this.promSingle(selectedItem);
        } else if ("PROM_SERIES".equals(selectedItem.getTypeIdS())) {
            this.promSeries(selectedItem);
        } else if ("PROM_HY".equals(selectedItem.getTypeIdS())) {
            this.promHy(selectedItem);
        } else if ("PROM_COMBIN".equals(selectedItem.getTypeIdS())) {
            this.promCombin(selectedItem);
        }
        this.salesReceiptsMainController.getTableView().refresh();
    }

    private void promCombin(SaleActSelectTableTwoData selectedItem) {
        block4: {
            GetSalesReceiptsTableOutData item;
            GetNumAmtData numAmtData;
            int i;
            GetPromByProCodeOutData promByProCodeOutData;
            ObservableList items;
            String unionMoney;
            List<GetNumAmtData> numAmtDataList;
            block3: {
                ActiveInfo activeInfo = selectedItem.getActiveInfo();
                numAmtDataList = activeInfo.getNumAmtDataList();
                unionMoney = activeInfo.getUnionMoney();
                String unionDis = activeInfo.getUnionDis();
                items = this.salesReceiptsMainController.getTableView().getItems();
                SaleActSelectTableOneData selectedItem1 = (SaleActSelectTableOneData)this.tableView.getSelectionModel().getSelectedItem();
                promByProCodeOutData = this.promByProCodeOutDataArrayList.get(Integer.valueOf(selectedItem1.getIndexF()) - 1);
                if (!ObjectUtil.isNotEmpty(unionDis)) break block3;
                for (int i2 = 0; i2 < numAmtDataList.size(); ++i2) {
                    GetNumAmtData numAmtData2 = numAmtDataList.get(i2);
                    GetSalesReceiptsTableOutData item2 = (GetSalesReceiptsTableOutData)items.get(Integer.valueOf(numAmtData2.getIndex()) - 1);
                    item2.setDisc(unionDis);
                    float price = Float.valueOf(item2.getPrcAmount()).floatValue() * Float.valueOf(unionDis).floatValue() / 100.0f;
                    item2.setPrice(CommonUtil.format2(price));
                    item2.setTotal(CommonUtil.format2(price * Float.valueOf(item2.getNum()).floatValue()));
                    item2.setSelectPromByProCodeOutData(promByProCodeOutData);
                }
                break block4;
            }
            if (!ObjectUtil.isNotEmpty(unionMoney)) break block4;
            float totalMoney = 0.0f;
            for (i = 0; i < numAmtDataList.size(); ++i) {
                numAmtData = numAmtDataList.get(i);
                item = (GetSalesReceiptsTableOutData)items.get(Integer.valueOf(numAmtData.getIndex()) - 1);
                totalMoney += Float.valueOf(item.getNum()).floatValue() * Float.valueOf(item.getPrcAmount()).floatValue();
            }
            for (i = 0; i < numAmtDataList.size(); ++i) {
                numAmtData = numAmtDataList.get(i);
                item = (GetSalesReceiptsTableOutData)items.get(Integer.valueOf(numAmtData.getIndex()) - 1);
                float money = Float.valueOf(item.getNum()).floatValue() * Float.valueOf(item.getPrcAmount()).floatValue() / totalMoney * Float.valueOf(unionMoney).floatValue();
                item.setTotal(CommonUtil.format2(money));
                float priceInf = money / Float.valueOf(item.getNum()).floatValue();
                item.setPrice(CommonUtil.format2(priceInf));
                item.setDisc(CommonUtil.format2(priceInf / Float.valueOf(item.getPrcAmount()).floatValue()));
                item.setSelectPromByProCodeOutData(promByProCodeOutData);
            }
        }
    }

    private void promHy(SaleActSelectTableTwoData selectedItem) {
        SaleActSelectTableOneData selectedItem2 = (SaleActSelectTableOneData)this.tableView.getSelectionModel().getSelectedItem();
        GetPromByProCodeOutData promByProCodeOutData = this.promByProCodeOutDataArrayList.get(Integer.valueOf(selectedItem2.getIndexF()) - 1);
        GetSalesReceiptsTableOutData selectedItem1 = (GetSalesReceiptsTableOutData)this.salesReceiptsMainController.getTableView().getSelectionModel().getSelectedItem();
        selectedItem1.setSelectPromByProCodeOutData(promByProCodeOutData);
        String dis = selectedItem.getDis();
        String disPrice = selectedItem.getDisPrice();
        if ("1".equals(selectedItem.getMemberFlag())) {
            if (ObjectUtil.isNotEmpty(disPrice)) {
                selectedItem1.setPrice(CommonUtil.format2(Float.valueOf(disPrice).floatValue()));
                selectedItem1.setStatus("\u4f1a\u5458\u65e5\u7279\u4ef7");
                float v = Float.valueOf(disPrice).floatValue() / Float.valueOf(selectedItem1.getPrcAmount()).floatValue() * 100.0f;
                selectedItem1.setDisc(String.valueOf((int)v));
                Float totalMoney = Float.valueOf(Float.valueOf(disPrice).floatValue() * Float.valueOf(selectedItem1.getNum()).floatValue());
                selectedItem1.setTotal(CommonUtil.format2(totalMoney.floatValue()));
            } else if (ObjectUtil.isNotEmpty(dis)) {
                Float priceInface = Float.valueOf(Float.valueOf(selectedItem1.getPrcAmount()).floatValue() * Float.valueOf(dis).floatValue() / 100.0f);
                selectedItem1.setPrice(CommonUtil.format2(priceInface.floatValue()));
                selectedItem1.setStatus("\u4f1a\u5458\u65e5\u7279\u4ef7");
                selectedItem1.setDisc(dis);
                Float totalMoney = Float.valueOf(priceInface.floatValue() * Float.valueOf(selectedItem1.getNum()).floatValue());
                selectedItem1.setTotal(CommonUtil.format2(totalMoney.floatValue()));
            }
        } else if ("2".equals(selectedItem.getMemberFlag())) {
            Float priceInface = Float.valueOf(Float.valueOf(selectedItem1.getPrcAmount()).floatValue() * Float.valueOf(dis).floatValue() / 100.0f);
            selectedItem1.setPrice(CommonUtil.format2(priceInface.floatValue()));
            selectedItem1.setStatus("\u4f1a\u5458\u65e5\u6298\u6263");
            selectedItem1.setDisc(dis);
            Float totalMoney = Float.valueOf(priceInface.floatValue() * Float.valueOf(selectedItem1.getNum()).floatValue());
            selectedItem1.setTotal(CommonUtil.format2(totalMoney.floatValue()));
        } else if ("3".equals(selectedItem.getMemberFlag())) {
            if (ObjectUtil.isNotEmpty(disPrice)) {
                selectedItem1.setPrice(CommonUtil.format2(Float.valueOf(disPrice).floatValue()));
                selectedItem1.setStatus("\u4f1a\u5458\u4ef7");
                float v = Float.valueOf(disPrice).floatValue() / Float.valueOf(selectedItem1.getPrcAmount()).floatValue() * 100.0f;
                selectedItem1.setDisc(String.valueOf((int)v));
                Float totalMoney = Float.valueOf(Float.valueOf(disPrice).floatValue() * Float.valueOf(selectedItem1.getNum()).floatValue());
                selectedItem1.setTotal(CommonUtil.format2(totalMoney.floatValue()));
            } else if (ObjectUtil.isNotEmpty(dis)) {
                Float priceInface = Float.valueOf(Float.valueOf(selectedItem1.getPrcAmount()).floatValue() * Float.valueOf(dis).floatValue() / 100.0f);
                selectedItem1.setPrice(CommonUtil.format2(priceInface.floatValue()));
                selectedItem1.setStatus("\u4f1a\u5458\u4ef7");
                selectedItem1.setDisc(dis);
                Float totalMoney = Float.valueOf(priceInface.floatValue() * Float.valueOf(selectedItem1.getNum()).floatValue());
                selectedItem1.setTotal(CommonUtil.format2(totalMoney.floatValue()));
            }
        }
    }

    private void promSeries(SaleActSelectTableTwoData selectedItem) {
        TableView<GetSalesReceiptsTableOutData> mainTableView = this.salesReceiptsMainController.getTableView();
        HashMap<String, Object> param = new HashMap<String, Object>();
        param.put("numAmtDataMap", this.salesReceiptsMainController.proGroup());
        param.put("voucherId", selectedItem.getVoucherIdS());
        param.put("proCode", selectedItem.getProCodeS());
        param.put("gsphType", selectedItem.getTypeIdS());
        param.put("serial", selectedItem.getSerial());
        param.put("normalPrice", selectedItem.getNormalPriceS());
        HttpJson httpJson = SalesReceiptsUtil.getDisPrice(param);
        GetDisPriceOutData disPriceOutData = null;
        if (httpJson.isSuccess()) {
            disPriceOutData = (GetDisPriceOutData)JSON.parseObject((String)httpJson.getMsg(), GetDisPriceOutData.class);
            String money = disPriceOutData.getMoney();
            log.info("\u7cfb\u5217\u4fc3\u9500\u603b\u91d1\u989d\uff1a" + money);
            String gsphExclusion = disPriceOutData.getGsphExclusion();
            String allPro = disPriceOutData.getAllPro();
            Set<String> proIds = disPriceOutData.getProIds();
            SaleActSelectTableOneData selectedItem1 = (SaleActSelectTableOneData)this.tableView.getSelectionModel().getSelectedItem();
            GetPromByProCodeOutData promByProCodeOutData = this.promByProCodeOutDataArrayList.get(Integer.valueOf(selectedItem1.getIndexF()) - 1);
            if ("assign1".equals(allPro)) {
                float moneyTemp;
                GetSalesReceiptsTableOutData item;
                int i;
                Float totalMoney = Float.valueOf(0.0f);
                for (i = 0; i < mainTableView.getItems().size(); ++i) {
                    item = (GetSalesReceiptsTableOutData)mainTableView.getItems().get(i);
                    moneyTemp = Float.valueOf(item.getNum()).floatValue() * Float.valueOf(item.getPrcAmount()).floatValue();
                    totalMoney = Float.valueOf(totalMoney.floatValue() + moneyTemp);
                }
                for (i = 0; i < mainTableView.getItems().size(); ++i) {
                    item = (GetSalesReceiptsTableOutData)mainTableView.getItems().get(i);
                    moneyTemp = Float.valueOf(item.getNum()).floatValue() * Float.valueOf(item.getPrcAmount()).floatValue();
                    float nowMoney = moneyTemp / totalMoney.floatValue() * Float.valueOf(money).floatValue();
                    float price = nowMoney / Float.valueOf(item.getNum()).floatValue();
                    item.setTotal(CommonUtil.format2(nowMoney));
                    item.setPrice(CommonUtil.format2(price));
                    item.setStatus("\u4fc3\u9500\u4ef7");
                    item.setGsphExclusion(gsphExclusion);
                    float v = 100.0f * Float.valueOf(price).floatValue() / Float.valueOf(item.getPrcAmount()).floatValue();
                    item.setDisc(String.valueOf((int)v));
                    item.setSelectPromByProCodeOutData(promByProCodeOutData);
                }
            } else if ("assign2".equals(allPro)) {
                float moneyTemp;
                GetSalesReceiptsTableOutData item;
                int i;
                Set<String> proIds1 = disPriceOutData.getProIds();
                Float totalMoney = Float.valueOf(0.0f);
                for (i = 0; i < mainTableView.getItems().size(); ++i) {
                    item = (GetSalesReceiptsTableOutData)mainTableView.getItems().get(i);
                    if (!proIds1.contains(item.getProCode())) continue;
                    moneyTemp = Float.valueOf(item.getNum()).floatValue() * Float.valueOf(item.getPrcAmount()).floatValue();
                    totalMoney = Float.valueOf(totalMoney.floatValue() + moneyTemp);
                }
                for (i = 0; i < mainTableView.getItems().size(); ++i) {
                    item = (GetSalesReceiptsTableOutData)mainTableView.getItems().get(i);
                    if (!proIds1.contains(item.getProCode())) continue;
                    moneyTemp = Float.valueOf(item.getNum()).floatValue() * Float.valueOf(item.getPrcAmount()).floatValue();
                    float nowMoney = moneyTemp / totalMoney.floatValue() * Float.valueOf(money).floatValue();
                    float price = nowMoney / Float.valueOf(item.getNum()).floatValue();
                    item.setTotal(CommonUtil.format2(nowMoney));
                    item.setPrice(CommonUtil.format2(price));
                    item.setStatus("\u4fc3\u9500\u4ef7");
                    item.setGsphExclusion(gsphExclusion);
                    float v = 100.0f * Float.valueOf(price).floatValue() / Float.valueOf(item.getPrcAmount()).floatValue();
                    item.setDisc(String.valueOf((int)v));
                    item.setSelectPromByProCodeOutData(promByProCodeOutData);
                }
            }
        } else {
            Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", httpJson.getMsg());
            alert.showAndWait();
            return;
        }
    }

    private void promSingle(SaleActSelectTableTwoData selectedItem) {
        TableView<GetSalesReceiptsTableOutData> mainTableView = this.salesReceiptsMainController.getTableView();
        String count = this.salesReceiptsMainController.countSenglePro(selectedItem.getProCodeS());
        GetSalesReceiptsTableOutData selectedItemTemp = (GetSalesReceiptsTableOutData)this.salesReceiptsMainController.getTableView().getSelectionModel().getSelectedItem();
        if ("1".equals(selectedItemTemp.getIsGift()) || "\u62c6\u96f6".equals(selectedItemTemp.getStatus()) || "\u6539\u4ef7".equals(selectedItemTemp.getStatus()) || "exclusion1".equals(selectedItemTemp.getGsphExclusion()) || "exclusion3".equals(selectedItemTemp.getGsphExclusion())) {
            count = String.valueOf(Float.valueOf(count).floatValue() + Float.valueOf(selectedItemTemp.getNum()).floatValue());
        }
        HashMap<String, Object> param = new HashMap<String, Object>();
        param.put("num", count);
        param.put("voucherId", selectedItem.getVoucherIdS());
        param.put("proCode", selectedItem.getProCodeS());
        param.put("gsphType", selectedItem.getTypeIdS());
        param.put("serial", selectedItem.getSerial());
        param.put("normalPrice", selectedItem.getNormalPriceS());
        HttpJson httpJson = SalesReceiptsUtil.getDisPrice(param);
        GetDisPriceOutData disPriceOutData = null;
        if (httpJson.isSuccess()) {
            disPriceOutData = (GetDisPriceOutData)JSON.parseObject((String)httpJson.getMsg(), GetDisPriceOutData.class);
            String money = disPriceOutData.getMoney();
            log.info("\u5355\u54c1\u4fc3\u9500\u603b\u91d1\u989d\uff1a" + money);
            BigDecimal price = null;
            price = new BigDecimal(money).divide(new BigDecimal(count));
            String priceInfact = CommonUtil.bigDecimalTo2fStr(price);
            SaleActSelectTableOneData selectedItem1 = (SaleActSelectTableOneData)this.tableView.getSelectionModel().getSelectedItem();
            GetPromByProCodeOutData promByProCodeOutData = this.promByProCodeOutDataArrayList.get(Integer.valueOf(selectedItem1.getIndexF()) - 1);
            for (int i = 0; i < mainTableView.getItems().size(); ++i) {
                GetSalesReceiptsTableOutData item = (GetSalesReceiptsTableOutData)mainTableView.getItems().get(i);
                if ("\u62c6\u96f6".equals(item.getStatus()) || "\u6539\u4ef7".equals(item.getStatus()) || !selectedItem.getProCodeS().equals(item.getProCode())) continue;
                BigDecimal newMoney = new BigDecimal(money).divide(new BigDecimal(count)).multiply(new BigDecimal(item.getNum()));
                item.setTotal(CommonUtil.bigDecimalTo2fStr(newMoney));
                item.setStatus("\u4fc3\u9500");
                item.setGsphExclusion(disPriceOutData.getGsphExclusion());
                item.setPrice(priceInfact);
                item.setDisc(String.valueOf((int)(100.0f * Float.valueOf(priceInfact).floatValue() / Float.valueOf(item.getPrcAmount()).floatValue())));
                item.setSelectPromByProCodeOutData(promByProCodeOutData);
            }
        } else {
            Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", httpJson.getMsg());
            alert.showAndWait();
            return;
        }
    }

    @FXML
    private void cancelAction() {
        this.pane.getScene().getWindow().hide();
    }
}

